import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 通知通告维护列表分页查询
// export const pageNotificationMaintaion = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification`, { params });
export const pageNotificationMaintaion = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getNoticeInfos`, { params });

//
export const getNoticeJxsInfos = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getNoticeJxsInfos`, { params });

// 通知通告新增
export const addNotification = (params) => axios.post(`${SERVER.DMSCLOUD_BASEDATA}/notification/add`, params);

// 通过type获取tc_code
export const getTcCodeByType = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/code/queryTcCodeByType`, { params });

// 通过ID获取通知通告数据
export const getNotificationById = (id) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/detail/${id}`, {id: Number(id)});

// 通过ID修改通知通告数据
export const updateNotification = (params,id) => axios.put(`${SERVER.DMSCLOUD_BASEDATA}/notification/update/${id}`, params,{id: Number(id)});

// 通过IDS撤回已经下发的数据
export const withdrawNotificationByIds = (params) => axios.post(`${SERVER.DMSCLOUD_BASEDATA}/notification/withdraw`, params);

// 通过ID下发通知通告数据
export const publishNotification = (params,id) => axios.put(`${SERVER.DMSCLOUD_BASEDATA}/notification/publish/${id}`, params,{id: Number(id)});

// 获取所有的厂端角色
export const getOemRole = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/getRole`, { params });
// 获取车场角色--cyx
export const getUserRoleName = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/userRoleName`, { params });

//通过ID删除数据
export const deleteNotification = (id) => axios.delete(`${SERVER.DMSCLOUD_BASEDATA}/notification/${id}`);
//编辑保存
export const putNotification = (params) => axios.put(`${SERVER.DMSCLOUD_BASEDATA}/notification/update/${params.notificationId}`,params);

//已读数据
export const getIsReadList = (id) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getIsReadList/${id}`, );
//进销商已读列表
export const getJxsIsReadList = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getJxsIsReadList/${params.id}`, );
//进销商未读
export const getJxsNoReadList = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getJxsNoReadList/${params.id}`, );
//车厂已读列表
export const getCcIsReadList = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getCcIsReadList/${params.id}`, );
//车厂未读
export const getCcNoReadList = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getCcNoReadList/${params.id}`, );

//车厂未读进销商
export const getJxsNoReadLists = (params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/notification/getJxsNoReadLists/${params.id}`, );
//导出

export const exportOrders = params => {
      return axios({
          url:`${SERVER.DMSCLOUD_BASEDATA}/notification/notificationFeedback/export/excel`,
          method:'get',
    //       params:params,
          responseType: 'blob'
      });
    };


